home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 12571 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.5 KB

  1. Path: news.ahc.ameritech.com!datalytics!usenet
  2. From: Rob Stewart <stew@datalytics.com>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: size_t
  5. Date: Wed, 20 Mar 1996 12:23:54 -0500
  6. Organization: Datalytics, Inc
  7. Message-ID: <31503F2A.C6F@datalytics.com>
  8. References: <4io7lj$482@hermes.acs.unt.edu> <4iomcj$c7m@moody.mchh.siemens.de>
  9. NNTP-Posting-Host: 204.62.224.71
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0 (WinNT; I)
  14.  
  15. Ronald Fischer wrote:
  16. > bgoodman@deathstar.cascss.unt.edu (Byron Goodman) wrote:
  17. > >
  18. > >Could some please explain what size_t data type is?  From what I understand
  19. > >it is the sizeof() a pointer to a function.
  20. > >
  21. > sizeof(T)  is the number of bytes that an object of type T occupies for
  22. > storage.
  23. > sizeof v   is the number of bytes that the variable or array v occupies for
  24. > storage.
  25. > This number is expresses as integral type size_t, which is often (but not
  26. > necessary) typedef'd to int.
  27.  
  28. I don't know of any implementation that typedefs size_t to int.  
  29. It would be a non-conforming implementation if it did.  
  30. According to ARM 5.3.2, size_t is "an implementation-dependent 
  31. unsigned integral type defined in the standard header 
  32. <stddef.h>."
  33.  
  34. As you have indicated above, sizeof returns a constant of type 
  35. size_t.  However, you are free to use size_t anywhere you like.  
  36. A common idiom is to use size_t for array indexes in 
  37. array/vector classes.
  38.  
  39. -- 
  40. Robert Stewart        | My opinions are usually my own.
  41. Datalytics, Inc.    | stew@datalytics.com
  42.